class JsonErrorMsg extends ErrorMsg {
	public function new(json:String, e:Error)
		
		var tmp:String = "Open Flash Chart\n\n";
		tmp += "JSON Parse Error ["+ e.message +"]\n";
		
		// find the end of line after the error location:
		var pos:Int = json.indexOf( "\n", e.errorID );
		var s:String = json.substr(0, pos);
		var lines:Array<String> = s.split("\n");
		
		tmp += "Error at character " + e.errorID + ", line " + lines.length +":\n\n";
		
		var i:Int = 3;
		while ( i > 0) {
			if( lines.length-i > -1 )
				tmp += (lines.length - i).toString() +": " + lines[lines.length - i];
				
			i-- ;
		}
		
		super( tmp );
	}
}
